import instance from "./require";
import type { noticeTS, noticetypeTS } from "@/store/crmsTS";

//获取数据
export let http_noticelist = (): Promise<Array<noticeTS>> => {
    return instance.get('/notice')
}
export let http_noticelisttype = (): Promise<Array<noticetypeTS>> => {
    return instance.get('/noticetypeId')
}




//添加数据
export let http_addnotice = (obj: noticeTS): Promise<noticeTS> => {
    return instance.post('/notice', obj)
}

//编辑数据
export let updatanotice = (obj: noticeTS): Promise<noticeTS> => {
    return instance.patch(`/notice/${obj.id}`, obj)
}

//删除数据
export let delnotice = (id: number) => {
    return instance.delete(`/notice/${id}`)
}

//查询数据
export let search = (params) => {
    return instance.get('/notice', { params: { 'notice_like': params.notice, } })
}